home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWSemEvt / Sources / SLSemInt.cpp < prev   
Encoding:
Text File  |  1996-08-16  |  13.7 KB  |  420 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLSemInt.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #define FW_OSemanticInterface_Class_Source
  11. #include "SLSemInt.xih"
  12.  
  13. #ifndef FWSOMENV_H
  14. #include "FWSOMEnv.h"
  15. #endif
  16.  
  17. //========================================================================================
  18. //    Runtime Informations
  19. //========================================================================================
  20.  
  21. #ifdef FW_BUILD_MAC    
  22. #pragma segment fwsemevt
  23. #endif
  24.  
  25. #if defined(__MWERKS__) && GENERATING68K
  26. // A hack to work around a bug
  27. #pragma import list somPrintf, somParentNumResolve
  28. #endif
  29.  
  30. //========================================================================================
  31. //    class FW_OSemanticInterface
  32. //========================================================================================
  33.  
  34. //----------------------------------------------------------------------------------------
  35. //    FW_OSemanticInterface::InitODFSemanticInterface
  36. //----------------------------------------------------------------------------------------
  37.  
  38. SOM_Scope void  SOMLINK FW_OSemanticInterface__InitODFSemanticInterface(FW_OSemanticInterface *somSelf, 
  39.         Environment *ev,
  40.         ODPart* base,
  41.         ODSession* session,
  42.         FW_CSemanticInterface* semInt,
  43.         FW_HSemIntGlueProcs semIntGlue)
  44. {
  45.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  46.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__InitODFSemanticInterface");
  47.         
  48.     somThis->fGlueProcs = semIntGlue;
  49.     somThis->fSemanticInterface = semInt;
  50.  
  51.     somSelf->InitSemanticInterface(ev, base, session);
  52. }
  53.  
  54. //----------------------------------------------------------------------------------------
  55. //    FW_OSemanticInterface::somUninit
  56. //----------------------------------------------------------------------------------------
  57.  
  58. SOM_Scope void  SOMLINK FW_OSemanticInterface__somUninit(FW_OSemanticInterface *somSelf)
  59. {
  60.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  61.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__somUninit");
  62.         
  63.     FW_TRY
  64.     {
  65.         FW_SOMEnvironment ev;
  66.         somSelf->UsingPredispatchProc(ev, FALSE);
  67.     }
  68.     FW_CATCH_BEGIN
  69.     FW_CATCH_EVERYTHING()
  70.     {
  71.     }
  72.     FW_CATCH_END
  73.  
  74.     FW_OSemanticInterface_parent_ODSemanticInterface_somUninit(somSelf);
  75. }
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    FW_OSemanticInterface::Release
  79. //----------------------------------------------------------------------------------------
  80.  
  81. SOM_Scope void  SOMLINK FW_OSemanticInterface__Release(FW_OSemanticInterface *somSelf, 
  82.     Environment *ev)
  83. {
  84.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  85.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__Release");
  86.  
  87.     FW_Boolean isValid = somSelf->IsValid(ev);
  88.     
  89.     FW_OSemanticInterface_parent_ODSemanticInterface_Release(somSelf,ev);
  90.         
  91.     if (!isValid && somSelf->GetRefCount(ev) == 0)
  92.         delete somSelf;
  93. }
  94.  
  95. //----------------------------------------------------------------------------------------
  96. //    FW_OSemanticInterface::CallEventHandler
  97. //----------------------------------------------------------------------------------------
  98.  
  99. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallEventHandler(FW_OSemanticInterface *somSelf, 
  100.         Environment *ev,
  101.         ODPart* thePart,
  102.         ODAppleEvent* theODAppleEvent,
  103.         ODAppleEvent* reply)
  104. {
  105. FW_UNUSED(thePart);
  106.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  107.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallEventHandler");
  108.     
  109.     FW_PlatformError error;
  110.     
  111.     if (somSelf->IsValid(ev))
  112.     {
  113.         error = CallUniversalProc(somThis->fGlueProcs->_fCallEventHandlerGlue, 
  114.             FW_uppCallEventHandlerProcInfo, ev, somThis->fSemanticInterface, 
  115.             theODAppleEvent, reply);
  116.     }
  117.     else
  118.         error = kODErrInvalidExtension;
  119.  
  120.     if (error != FW_xNoError)
  121.         FW_SetEvError(ev, error);
  122. }
  123.  
  124. //----------------------------------------------------------------------------------------
  125. //    FW_OSemanticInterface::CallCoercionHandler
  126. //----------------------------------------------------------------------------------------
  127.  
  128. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallCoercionHandler(FW_OSemanticInterface *somSelf, 
  129.         Environment *ev,
  130.         ODPart* thePart,
  131.         ODDesc* theODDesc,
  132.         ODDescType toType,
  133.         ODDesc* theResult)
  134. {
  135. FW_UNUSED(thePart);
  136.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  137.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallCoercionHandler");
  138.     
  139.     FW_PlatformError error;
  140.     
  141.     if (somSelf->IsValid(ev))
  142.     {
  143.         error = CallUniversalProc(somThis->fGlueProcs->_fCallCoercionHandlerGlue, 
  144.             FW_uppCallCoercionHandlerProcInfo, ev, somThis->fSemanticInterface, 
  145.             theODDesc, toType, theResult);
  146.     }
  147.     else
  148.         error = kODErrInvalidExtension;
  149.  
  150.     if (error != FW_xNoError)
  151.         FW_SetEvError(ev, error);
  152. }
  153.  
  154. //----------------------------------------------------------------------------------------
  155. //    FW_OSemanticInterface::CallPredispatchProc
  156. //----------------------------------------------------------------------------------------
  157.  
  158. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallPredispatchProc(FW_OSemanticInterface *somSelf, 
  159.         Environment *ev,
  160.         ODPart* thePart,
  161.         ODAppleEvent* theODAppleEvent,
  162.         ODAppleEvent* reply)
  163. {
  164. FW_UNUSED(thePart);
  165.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  166.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallPredispatchProc");
  167.  
  168.     FW_PlatformError error;
  169.     
  170.     if (somSelf->IsValid(ev))
  171.     {
  172.         error =  CallUniversalProc(somThis->fGlueProcs->_fCallPredispatchProcGlue, 
  173.             FW_uppCallPredispatchProcInfo, ev, somThis->fSemanticInterface, 
  174.             theODAppleEvent, reply);
  175.     }
  176.     else
  177.         error = kODErrInvalidExtension;
  178.  
  179.     if (error != FW_xNoError)
  180.         FW_SetEvError(ev, error);
  181. }
  182.  
  183. //----------------------------------------------------------------------------------------
  184. //    FW_OSemanticInterface::CallObjectAccessor
  185. //----------------------------------------------------------------------------------------
  186.  
  187. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallObjectAccessor(FW_OSemanticInterface *somSelf, 
  188.         Environment *ev,
  189.         ODPart* thePart,
  190.         ODDescType desiredClass,
  191.         ODOSLToken* container,
  192.         ODDescType containerClass,
  193.         ODDescType form,
  194.         ODDesc* selectionData,
  195.         ODOSLToken* value)
  196. {
  197. FW_UNUSED(thePart);
  198.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  199.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallObjectAccessor");
  200.  
  201.     FW_PlatformError error;
  202.     
  203.     if (somSelf->IsValid(ev))
  204.     {
  205.         error = CallUniversalProc(somThis->fGlueProcs->_fCallObjectAccessorGlue, 
  206.             FW_uppCallObjectAccessorProcInfo, ev, somThis->fSemanticInterface, 
  207.             desiredClass, container, containerClass, form, selectionData, value);
  208.     }
  209.     else
  210.         error = kODErrInvalidExtension;
  211.  
  212.     if (error != FW_xNoError)
  213.         FW_SetEvError(ev, error);
  214. }
  215.  
  216. //----------------------------------------------------------------------------------------
  217. //    FW_OSemanticInterface::CallCompareProc
  218. //----------------------------------------------------------------------------------------
  219.  
  220. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallCompareProc(FW_OSemanticInterface *somSelf, 
  221.         Environment *ev,
  222.         ODPart* thePart,
  223.         ODDescType oper,
  224.         ODOSLToken* obj1,
  225.         ODOSLToken* obj2,
  226.         ODBoolean* result)
  227. {
  228. FW_UNUSED(thePart);
  229.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  230.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallCompareProc");
  231.  
  232.     FW_PlatformError error;
  233.     
  234.     if (somSelf->IsValid(ev))
  235.     {
  236.         error = CallUniversalProc(somThis->fGlueProcs->_fCallCompareProcGlue, 
  237.             FW_uppCallCompareProcInfo, ev, somThis->fSemanticInterface, oper, obj1, obj2, result);
  238.     }
  239.     else
  240.         error = kODErrInvalidExtension;
  241.  
  242.     if (error != FW_xNoError)
  243.         FW_SetEvError(ev, error);
  244. }
  245.  
  246. //----------------------------------------------------------------------------------------
  247. //    FW_OSemanticInterface::CallCountProc
  248. //----------------------------------------------------------------------------------------
  249.  
  250. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallCountProc(FW_OSemanticInterface *somSelf, 
  251.         Environment *ev,
  252.         ODPart* thePart,
  253.         ODDescType desiredType,
  254.         ODDescType containerClass,
  255.         ODOSLToken* container,
  256.         ODSLong* result)
  257. {
  258. FW_UNUSED(thePart);
  259.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  260.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallCountProc");
  261.  
  262.     FW_PlatformError error;
  263.     
  264.     if (somSelf->IsValid(ev))
  265.     {
  266.         error = CallUniversalProc(somThis->fGlueProcs->_fCallCountProcGlue, 
  267.             FW_uppCallCountProcInfo, ev, somThis->fSemanticInterface, desiredType, 
  268.             containerClass, container, result);
  269.     }
  270.     else
  271.         error = kODErrInvalidExtension;
  272.  
  273.     if (error != FW_xNoError)
  274.         FW_SetEvError(ev, error);
  275. }
  276.  
  277. //----------------------------------------------------------------------------------------
  278. //    FW_OSemanticInterface::CallDisposeTokenProc
  279. //----------------------------------------------------------------------------------------
  280.  
  281. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallDisposeTokenProc(FW_OSemanticInterface *somSelf, 
  282.         Environment *ev,
  283.         ODPart* thePart,
  284.         ODOSLToken* unneededToken)
  285. {
  286. FW_UNUSED(thePart);
  287.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  288.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallDisposeTokenProc");
  289.  
  290.     FW_PlatformError error;
  291.     
  292.     if (somSelf->IsValid(ev))
  293.     {
  294.         error = CallUniversalProc(somThis->fGlueProcs->_fCallDisposeTokenProcGlue, 
  295.             FW_uppCallDisposeTokenProc, ev, somThis->fSemanticInterface, unneededToken);
  296.     }
  297.     else
  298.         error = kODErrInvalidExtension;
  299.  
  300.     if (error != FW_xNoError)
  301.         FW_SetEvError(ev, error);
  302. }
  303.  
  304. //----------------------------------------------------------------------------------------
  305. //    FW_OSemanticInterface::CallGetErrDescProc
  306. //----------------------------------------------------------------------------------------
  307.  
  308. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallGetErrDescProc(FW_OSemanticInterface *somSelf, 
  309.         Environment *ev,
  310.         ODPart* thePart,
  311.         ODDesc** errDesc)
  312. {
  313. FW_UNUSED(thePart);
  314.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  315.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallGetErrDescProc");
  316.  
  317.     FW_PlatformError error;
  318.     
  319.     if (somSelf->IsValid(ev))
  320.     {
  321.         error = CallUniversalProc(somThis->fGlueProcs->_fCallGetErrDescProcGlue, 
  322.             FW_uppCallGetErrDescProcInfo, ev, somThis->fSemanticInterface, errDesc);
  323.     }
  324.     else
  325.         error = kODErrInvalidExtension;
  326.  
  327.     if (error != FW_xNoError)
  328.         FW_SetEvError(ev, error);
  329. }
  330.  
  331. //----------------------------------------------------------------------------------------
  332. //    FW_OSemanticInterface::CallGetMarkTokenProc
  333. //----------------------------------------------------------------------------------------
  334.  
  335. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallGetMarkTokenProc(FW_OSemanticInterface *somSelf, 
  336.         Environment *ev,
  337.         ODPart* thePart,
  338.         ODOSLToken* dContainerToken,
  339.         ODDescType containerClass,
  340.         ODOSLToken* result)
  341. {
  342. FW_UNUSED(thePart);
  343.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  344.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallGetMarkTokenProc");
  345.  
  346.     FW_PlatformError error;
  347.     
  348.     if (somSelf->IsValid(ev))
  349.     {
  350.         error = CallUniversalProc(somThis->fGlueProcs->_fCallGetMarkTokenProcGlue, 
  351.             FW_uppCallGetMarkTokenProcInfo, ev, somThis->fSemanticInterface, dContainerToken, 
  352.             containerClass, result);
  353.     }
  354.     else
  355.         error = kODErrInvalidExtension;
  356.  
  357.     if (error != FW_xNoError)
  358.         FW_SetEvError(ev, error);
  359. }
  360.  
  361. //----------------------------------------------------------------------------------------
  362. //    FW_OSemanticInterface::CallMarkProc
  363. //----------------------------------------------------------------------------------------
  364.  
  365. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallMarkProc(FW_OSemanticInterface *somSelf, 
  366.         Environment *ev,
  367.         ODPart* thePart,
  368.         ODOSLToken* dToken,
  369.         ODOSLToken* markToken,
  370.         ODSLong index)
  371. {
  372. FW_UNUSED(thePart);
  373.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  374.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallMarkProc");
  375.  
  376.     FW_PlatformError error;
  377.     
  378.     if (somSelf->IsValid(ev))
  379.     {
  380.         error = CallUniversalProc(somThis->fGlueProcs->_fCallMarkProcGlue, 
  381.             FW_uppCallMarkProcInfo, ev, somThis->fSemanticInterface, dToken,
  382.             markToken, index);
  383.     }
  384.     else
  385.         error = kODErrInvalidExtension;
  386.  
  387.     if (error != FW_xNoError)
  388.         FW_SetEvError(ev, error);
  389. }
  390.  
  391. //----------------------------------------------------------------------------------------
  392. //    FW_OSemanticInterface::CallAdjustMarksProc
  393. //----------------------------------------------------------------------------------------
  394.  
  395. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallAdjustMarksProc(FW_OSemanticInterface *somSelf, 
  396.         Environment *ev,
  397.         ODPart* thePart,
  398.         ODSLong newStart,
  399.         ODSLong newStop,
  400.         ODOSLToken* markToken)
  401. {
  402. FW_UNUSED(thePart);
  403.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  404.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallAdjustMarksProc");
  405.  
  406.     FW_PlatformError error;
  407.     
  408.     if (somSelf->IsValid(ev))
  409.     {
  410.         error = CallUniversalProc(somThis->fGlueProcs->_fCallAdjustMarksProcGlue, 
  411.             FW_uppCallAdjustMarksProcInfo, ev, somThis->fSemanticInterface, newStart, 
  412.             newStop, markToken);
  413.     }
  414.     else
  415.         error = kODErrInvalidExtension;
  416.  
  417.     if (error != FW_xNoError)
  418.         FW_SetEvError(ev, error);
  419. }
  420.